package ByteStream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class ByteStreamDemo7 {
    public static void main(String[] args) throws IOException {
        FileInputStream fos = null;
        long start = 0;
        FileOutputStream fos2 = null;
        try {
            fos = new FileInputStream("E:\\Video\\当你有爱的超能力，你会不会使用超能力让对方爱上你.mp4");
            //计算时间
            start = System.currentTimeMillis();

            fos2 = new FileOutputStream("E:\\Education\\当你有爱的超能力，你会不会使用超能力让对方爱上你.mp4");
            int len = 0;
            byte[] bytes = new byte[1024*1024*5];

            while((len = fos.read(bytes)) != -1){
                fos2.write(bytes,0,len);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            long end = System.currentTimeMillis();
            System.out.println(end - start);
            try {
                fos2.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            try {
                fos.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
